<template>
  <div class="">
    <div class="return-btn">
      <van-button icon="arrow-left" type="default" to="/mine">历史记录</van-button>
    </div>
    <div class="history-list">
      <van-grid :border="false" :column-num="3">
        <van-grid-item
        v-for="item in obj"
        :key="item.id"
        :to="{ name: 'Detail', params: { id: item.id } }">
          <van-image :src="item.images.small" />
          <span>{{item.title}}</span>
        </van-grid-item>
      </van-grid>
    </div>
  </div>
</template>

<script>
export default {
  name: '',
  data () {
    return {
      obj: [],
    }
  },
  methods: {},
  mutations: {},
  components: {},
  created () {
    // console.log(this.$store.commit('historygetUse'))
    this.$store.commit('historygetUse')
    this.obj = JSON.parse(sessionStorage.getItem('history'))
    console.log(this.obj)
  },
}
</script>

<style lang='less' scoped>
.return-btn {
  margin: 20px 0 0 20px;
  .van-button--normal {
    font-size: 20px;
  }
  .van-button--default {
    border: none;
  }
}
.history-list{
    width: 330px;
    margin: 0 auto;
    span{
        margin-bottom: 0px;
    }
}
</style>
